package com.heima.comment.util;

import com.heima.common.aliyun.GreenTextScan;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Map;

public class CheckTextUtli {
    private CheckTextUtli() {
    }

    /*@Autowired
     GreenTextScan textScan;*/

    public static boolean checkText(String content) {
        boolean flag = false;
        GreenTextScan textScan = new GreenTextScan();
        try {
            Map map = textScan.greenTextScan("content");
            String suggestion = (String) map.get("suggestion");
            switch (suggestion){
                case  "pass":
                    flag = true;
                    break;
                case "block":
                    flag = false;
                    break;
                case "review":
                    flag = false;
                    break;
            }
        }  catch (Exception e) {
            e.printStackTrace();
        }

        return flag;
    }
}
